<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html class=" -webkit-">
	<head>
	<meta charset="utf-8">
    <title>杰利联合</title>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
	<meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
    <meta content="application/xhtml+xml;charset=UTF-8" http-equiv="Content-Type">
    <meta content="no-cache,must-revalidate" http-equiv="Cache-Control">
    <meta content="no-cache" http-equiv="pragma">
    <meta content="0" http-equiv="expires">
    <meta content="telephone=no, address=no" name="format-detection">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    	<link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
    <link rel="stylesheet" type="text/css" href="${ctxStatic}/jiu/css/mobile_module.css?v=1492657873" media="all">
    <script type="text/javascript" src="${ctxStatic}/jiu/js/jquery-2.0.3.min.js"></script>
	<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	<script type="text/javascript" src="${ctxStatic}/jiu/js/prefixfree.min.js?v=1492657873"></script>
	<script type="text/javascript" src="${ctxStatic}/jiu/js/dialog.js?v=1492657873"></script>
	<script type="text/javascript" src="${ctxStatic}/jiu/js/flipsnap.min.js?v=1492657873"></script>
	<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
    <script
	src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <link href="${ctxStatic}/jiu/css/common.css?v=1492657873" rel="stylesheet" type="text/css">	
    <link rel="stylesheet" href="${ctxStatic}/jiu/css/weui.min.css" />
    
		<style>
			.head{
				height: 50px;
				background-color: #30B0F3;
				width: 100%;
				text-align: center;
				color: white;
				font-size: 20px;
               line-height:50px;
			}
			
			.msgs {
				display: inline-block;
			    color: #fff;
			    font-size: 12px;
			    border: 1px solid #3399ff;
			    /* border-radius: 20px; */
			    text-align: center;
			    height: 40px;
			    line-height: 40px;
			    background: #3399ff;
			    cursor: pointer;
			    width: 30%;
			}
			.msgs1 {
				background: #E6E6E6;
				color: #818080;
				border: 1px solid #CCCCCC;
			}
		</style>
		<style>
		* {
			margin: 0px;
			padding: 0px;
		}
		
		.info {
			border-top: 1px solid #e8e8e8;
			border-bottom: 1px solid #e8e8e8;
			width: 100%;
		}
		
		.info-title {
			color: #3b3926;
			font-size: 12px;
			border-bottom: 1px solid #e8e8e8;
			line-height: 38px;
			text-indent: 1em;
			height: 38px;
			background-color: #f7f7f7;
		}
		
		.getphoto {
			height: 98px;
			width: 100%;
			background-color: #FFF;
			display: table;
		}
		
		.getphoto-img {
			position: relative;
			height: 68px;
			width: 68px;
			margin: 14px;
			background-color: #f7f7f7;
			border: 1px dashed #d2d2d2;
			background: no-repeat center center;
		    background-size: cover;
		}
		
		.getphoto-img img {
			margin: 23px;
			height: 24px;
			width: 24px;
		}
		
		.info-mark {
			/*margin-top: 10px;
			border-top: 1px solid #e8e8e8;
			border-bottom: 1px solid #e8e8e8;*/
		    -webkit-box-shadow: 0 0 0 1px #d7d7d7;
		    box-shadow: 0 0 0 1px #d7d7d7;
		}
		
		.styler {
			height: 40px;
		    -webkit-box-shadow: 0 0 0 1px #d7d7d7;
		    box-shadow: 0 0 0 1px #d7d7d7;
		}
		
		.styler input {
			border: 0;
			text-indent: 1em;
			background: #fff;
			width: 100%;
			height: 40px;
			line-height: 40px;
			outline: none;
			border-radius: 3px;
			padding: 5px;
			box-sizing: border-box;
			font-size: 14px;
		}
		.success {
		    font-family: "Microsoft YaHei", Arial, Helvetica, sans-serif;
		    text-align: center;
		    line-height: 40px;
		    width: 100%;
		    color: #fff;
		    border-radius: 3px;
		    float: left;
		    border: none;
		    font-size: 14px;
		    margin-bottom: 15px;
		    background: #e50012;
		    margin-top: 15px;
		}
		.cont {
		    overflow: auto;
		    padding: 15px 14px 0;
		}
		.weui-uploader__input {
		    position: absolute;
		    z-index: 1;
		    top: 0;
		    left: 0;
		    width: 100%;
		    height: 100%;
		    opacity: 0;
		    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
		}
	</style>
		<script type="text/javascript">
			wx.config({
			    debug: false,
			    appId: '${weChatAppId}',
			    timestamp: '${timestamp}',
			    nonceStr: '${nonceStr}',
			    signature: '${signature}',
			    jsApiList: [
			      'checkJsApi',
			      'onMenuShareTimeline',
			      'onMenuShareAppMessage',
			      'onMenuShareQQ',
			      'onMenuShareWeibo',
			      'hideMenuItems',
			      'showMenuItems',
			      'hideAllNonBaseMenuItem',
			      'showAllNonBaseMenuItem',
			      'translateVoice',
			      'startRecord',
			      'stopRecord',
			      'onRecordEnd',
			      'playVoice',
			      'pauseVoice',
			      'stopVoice',
			      'uploadVoice',
			      'downloadVoice',
			      'chooseImage',
			      'previewImage',
			      'uploadImage',
			      'downloadImage',
			      'getNetworkType',
			      'openLocation',
			      'getLocation',
			      'hideOptionMenu',
			      'showOptionMenu',
			      'closeWindow',
			      'scanQRCode',
			      'chooseWXPay',
			      'openProductSpecificView',
			      'addCard',
			      'chooseCard',
			      'openCard'
			    ]
			});
			
			
				 localIds = "";
			function chooseImg(){
			
				wx.chooseImage({
					count: 1, // 默认9
				    sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
				    sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
				    success: function (res) {
				    	localIds = res.localIds; // 返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片
				        //$("#img").attr("src",localIds);
				    	
				        uploadImage();
				    }
				});
				
				
				 
			}
				
			function uploadImage(){
				wx.uploadImage({
				    localId: ''+localIds, // 需要上传的图片的本地ID，由chooseImage接口获得
				    isShowProgressTips: 0, // 默认为1，显示进度提示
				    success: function (res) {
				    	imgServerId = res.serverId; // 返回图片的服务器端ID
				    	
				    	  $.getJSON("${ctxFront}/jiu/uploadImd",{imgSId:imgServerId}, function(data){
			    		 		$('input[name=logo]').val(data.img);
		                  });
				    }
				});
			}
			
			
			
			$(function(){
				if("${empty jiuStore.logo}"=='true'){
					$('.weui-uploader__input-box').show();
				}else{
					$('.weui-uploader__files').show();
				}
				
			});
			
			
			function add(file){
				var preimg = $('.getphoto-img');
				if(file.files && file.files[0]) {
					var reader = new FileReader();
					reader.onload = function(evt) {
						preimg.css("background-image","url("+evt.target.result+")");
						$('#cx').hide();
					}
					reader.readAsDataURL(file.files[0]);
					var a = file.files[0];
					
				}
				
				
				 /* wx.chooseImage({
					count: 1, // 默认9
				    sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
				    sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
				    success: function (res) {
				    	localIds = res.localIds; // 返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片
				    	
				    	$('.weui-uploader__input-box').hide();
						$('.weui-uploader__files').show();
						$('.weui-uploader__file').css("background-image","url("+localIds+")");
				    	
				        uploadImage();
				    }
				}); */
				 
				
				
			}
			
			function edit(){
				wx.chooseImage({
					count: 1, // 默认9
				    sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
				    sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
				    success: function (res) {
				    	localIds = res.localIds; // 返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片
				    	
				    	$('.weui-uploader__file').css("background-image","url("+localIds+")");
				    	
				        uploadImage();
				    }
				});
				
			}
	</script>
	</head>
<body>
	<div id="container" class=""> 

		<header  class="head">
			<a href="javascript:window.history.go(-1)">
				<img src="${ctxStatic}/jiu/img/fanhui.png" style="height: 20px;color: white;top:15px;position: absolute;left: 10px;"/></a>
			注册
		</header>
				<div class="modal fade" style="margin-top: 30%;" id="myModal"
			tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<div class="modal-header" style="width:100%;position:relative">
						<button type="button" class="close" data-dismiss="modal"
							aria-label="Close" style="position:absolute;right:10px;text-align:right">
							<span aria-hidden="true">&times;</span>
						</button>
						<h4 class="modal-title" id="myModalLabel">操作提示</h4>
					</div>
					<div class="modal-body"></div>
					<div class="modal-footer" style="display:flex;justify-content:space-between;" >
						<button type="button" class="btn btn-success" data-dismiss="modal"
							id="yes" style="width:100px">确定</button>
						<button style="width:100px;background:red;" type="button" class="btn btn-danger" data-dismiss="modal"
							id="no">取消</button>
					</div>
				</div>
			</div>
		</div>
    <form class="m_15" method="post" id="addressform" action="${ctxFront }/jiu/saveStore" enctype="multipart/form-data">
        <table width="100%" cellpadding="5">
        	
            <tbody>
            	<input type="hidden" name="id" value="${jiuStore.id}"/>
            	<input type="hidden" name="userId" value="${jiuStore.userId}"/>
            	<input type="hidden" name="point" value="${jiuStore.point}"/>
            	<input type="hidden" name="examineState" value="${jiuStore.examineState}"/>
            	<input type="hidden" name="wechatId" value="${jiuStore.wechatId}"/>
            	<input type="hidden" name="memberId" value="${jiuStore.memberId}"/>
            	<input type="hidden" name="memberName" value="${jiuStore.memberName}"/>
            	<input type="hidden" name="headimgurl" value="${jiuStore.headimgurl}"/>
            	<input type="hidden" name="factoryId" value="${jiuStore.factoryId}"/>
            	<input type="hidden" name="factoryName" value="${jiuStore.factoryName}"/>
            	<input type="hidden" name="logo" value="${jiuStore.logo}"/>
            	<input type="hidden" name="realName" value="${jiuStore.realName}"/>
            	<input type="hidden" name="idNumber" value="${jiuStore.idNumber}"/>
            	
            	<input type="hidden" name="tiWechatId" value="${jiuStore.tiWechatId}"/>
            	<input type="hidden" name="tiMemberId" value="${jiuStore.tiMemberId}"/>
            	<input type="hidden" name="tiMemberName" value="${jiuStore.tiMemberName}"/>
            	<input type="hidden" name="tiHeadimgurl" value="${jiuStore.tiHeadimgurl}"/>
            	<input type="hidden" name="tiRealName" value="${jiuStore.tiRealName}"/>
            	<input type="hidden" name="bankCardNumber" value="${jiuStore.bankCardNumber}"/>
            	<input type="hidden" name="openingBank" value="${jiuStore.openingBank}"/>

            	
            	
            	 <tr>
            		<td>  
            			门店LOGO<br />
            			 	<div class="info">
								<div class="getphoto">
									<div class="getphoto-img">
										<img id="cx" src="http://me.hbweiyinqing.cn/Addons/IrontowerManage/View/default/Public/images/cphoto.png">
										<input id="uploaderInput" name="uploaderInput" class="weui-uploader__input" type="file" accept="image/*" multiple="" onchange="add(this)">
									</div>
								</div>
							</div>
            		</td>
            	</tr>
            	
            <tr height="70px">
                <td>门店名称<br><input type="text" name="name" value="${jiuStore.name}"><span id="nameerror" style="color: red"></span></td>
            </tr>
            <tr>
                <td height="70px">手机<br><input type="text" name="phone" value="${jiuStore.phone}"><span id="mobileerror" style="color: red"></span></td>
            </tr>
			<!-- <tr>
                <td height="70px">固定电话 (格式:0310-8129689)<br><input type="text" name="phone" value="111"><span id="mobileerror" style="color: red"></span></td>
            </tr> -->
            <tr>
                <td height="70px">详细地址<br><input type="text" name="address" value="${jiuStore.address}"><span id="addresserror" style="color: red"></span></td>
            </tr>
           
            <tr height="160px">
                <td>门店介绍<br><textarea name="storeDescribe">${jiuStore.storeDescribe}</textarea></td>
            </tr>
            <tr>
            	<td style="color: #999;">
            		注：请详细填写公司信息，方便客户跟你联系！
            	</td>
            	
            </tr>
            
            
            
             <tr>
			 	<td>			 		
						<span class="wenzi">验证码:</span>
						<div style="display: flex;background-color: #fff;border: 1px solid #CECDCD;">
							<input type="text" style="width: 70%;border: none;" name="code">
							<span class="msgs" >获取验证码</span>	
						</div>										
			 	</td>
			 </tr>
			 
			 
			 
            <tr>
                <td height="100px"><a class="btn" type="button" id="sbtn">保存资料</a></td>
            </tr>
            
        </tbody></table>
    </form>
    </div>
    <p class="copyright">杰利联合版权所有</p>

    <script type="text/javascript">
    var tag=0;
			$(document).ready(function(){

				$("#sbtn").click(function(){
					var name=$("input[name='name']").val();
					var phone=$("input[name='phone']").val();
					var address=$("input[name='address']").val();
					var code=$("input[name='code']").val();
					
					if(/^1[3,4,5,7,8]\d{9}$/g.test(phone)||(/^15[8,9]\d{8}$/g.test(phone))){
					}else{
						$("#mobileerror").text('请正确填写你的手机号码');
						return false;
					}
					
					
					if (phone=="") {
						$("#mobileerror").text('请填写你的手机号码');
						phone.focus();
					}else{
						$("#mobileerror").text('');
					}
					if (address=="") {
						$("#addresserror").text('请填写你的收货地址');
						address.focus();
					}else{
						$("#addresserror").text('');
					}
					if (name=="") {
						$("#nameerror").text('请填写门店名称');
						name.focus();
					}else{
						$("#nameerror").text('');
					}
					
					if(code==""){
						  $('#myModal').modal('show')  ;
		        		   $(".modal-body").text("验证码不能为空");
						return;
					}
					
					if(phone!=""&&address!=""&&name!=""){
						if(tag==1){
							return;
						}
						tag=1;
						
						
						  $.getJSON("${ctxFront }/jiu/validateCode",{mobile:phone,code:code}, function(data){
	                         $('#myModal').modal('show')  ;
			        		   $(".modal-body").text(data.message);
	                         if(data.msg=='success'){
	                        	 $("#yes").click(function(){
	                        		 $("#addressform").submit();
	                        	 });
	                        	/*   */
	                           }else{
	                        	 tag=0;
	                         }
	                     });
						
					}
				});			
			});
		</script>
		
		
		<script>
		
		$(function(){
			
			$(".msgs").click(function(){
					sendMobileSMS();
				});
			
		});
		
		
		function sendMobileSMS(){
			var mobile = $("input[name='phone']").val();
			if(mobile == null || mobile == ''){
				   $('#myModal').modal('show')  ;
        		   $(".modal-body").text("手机号不能为空!");
					return false;
			}else{
				var reg = /^0?1[3|4|5|7|8][0-9]\d{8}$/;
				if(!reg.test(mobile)){
					/* alert("请正确填写手机号!");
					return false; */
				}
			}
		  		$.ajax({	
				  type: 'POST',
				  url: "${ctxFront}/jiu/sendEditMobileSMS",
				  dataType: "json",
				  cache:true,
				  async:false,
				  data: {mobile: mobile},
			       success: function (data) {
					if(data.msg == 'success'){
						   $('#myModal').modal('show')  ;
		        		   $(".modal-body").text(data.message);
						$(".msgs").unbind("click");
						countDown();
					}else{
						if(data.msg=='error'){
							  $('#myModal').modal('show')  ;
			        		   $(".modal-body").text(data.message);
						}else{
							countDown();
						}
					}
			      }	
			});
		}
		
		var validCode = true;
		function countDown(){
			var time = 60;
			var code = $('.msgs');
			if(validCode) {
				validCode = false;
				code.addClass("msgs1");
				var t = setInterval(function() {
					time--;
					code.html(time + "秒");
					if(time == 0) {
						$(".msgs").click(function(){
							sendMobileSMS();
						});
						
						clearInterval(t);
						code.html("重新获取");
						validCode = true;
						code.removeClass("msgs1");
					}
				}, 1000)
			}
		}
		</script>
		<script type="text/javascript">
			/* function preview(file) {
			alert(12);
				var preimg = $('.getphoto-img');
				if(file.files && file.files[0]) {
					var reader = new FileReader();
					reader.onload = function(evt) {
						preimg.css("background-image","url("+evt.target.result+")");
						$('#cx').hide();
					}
					reader.readAsDataURL(file.files[0]);
					var a = file.files[0];
					
				}
			} */
		</script>
</body></html>